<div class="wrap">
    <div id="icon-upload" class="icon32"><br></div>
    <h2>Datové zdroje {if current_user_can('administrator') || current_user_can('editor')}<a href="{link target='self:addSource'}" class="add-new-h2">Přidat datový zdroj</a>{/if}</h2>
    {include file="messages.tpl"}
    <ul class="subsubsub">
        <li><a href="{link target='self:defaultAction'}"{if !isset($smarty.get.status_content)} class="current"{/if}>Celkem <span class="count">({$cnt.all})</span></a> |</li>
        <li><a href="{link target='self:defaultAction' status_content='image'}"{if $smarty.get.status_content == 'image'} class="current"{/if}>Obrázky <span class="count">({$cnt.image})</span></a> |</li>
        <li><a href="{link target='self:defaultAction' status_content='video'}"{if $smarty.get.status_content == 'video'} class="current"{/if}>Video <span class="count">({$cnt.video})</span></a> |</li>
        <li><a href="{link target='self:defaultAction' status_content='post'}"{if $smarty.get.status_content == 'post'} class="current"{/if}>Příspěvky <span class="count">({$cnt.post})</span></a></li>
    </ul>
    <form id="posts-filter" action="{link target='self:defaultBulkAction'}" method="post">
        <input name="token" type="hidden" value="{wp_nonce target='self:defaultBulkAction'}" />
        {if current_user_can('administrator') || current_user_can('editor')}
        <div class="tablenav top">
            <div class="alignleft actions">
                <select name="action1">
                    <option value="-1" selected="selected">Hromadné úpravy</option>
                    <option value="remove">Odstranit</option>
                </select>
                <input type="submit" name="" id="doaction" class="button-secondary action" value="Použít">
            </div>
            {include file="pager.tpl" position='top' pager=$pager page='defaultAction' append='orderBy,order'}
            <br class="clear">
        </div>
        {/if}
        <table class="wp-list-table widefat fixed pages" cellspacing="0">
            <thead>
                <tr>                    
                    <th scope="col" id="cb" class="manage-column column-cb check-column" style="">
                        <input type="checkbox">
                    </th>                                      
                    <th scope="col" id="title" class="manage-column column-icon">
                        
                    </th>
                    <th scope="col" id="title" class="manage-column column-title {sortstate orderedBy='name'}" style="">
                        <a href="{sortlink orderBy='name' append='paged'}"><span>Název</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" id="title" class="manage-column {sortstate orderedBy='content'}" style="">
                        <a href="{sortlink orderBy='content' append='paged'}"><span>Obsah zdroje</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" id="title" class="manage-column {sortstate orderedBy='type'}" style="">
                        <a href="{sortlink orderBy='type' append='paged'}"><span>Typ zdroje</span><span class="sorting-indicator"></span></a>
                    </th>
                </tr>
            </thead>
            <tfoot>
                <tr>                    
                    <th scope="col" id="cb" class="manage-column column-cb check-column" style="">
                        <input type="checkbox">
                    </th>     
                    <th scope="col" id="title" class="manage-column column-icon"></th>
                    <th scope="col" id="title" class="manage-column column-title {sortstate orderedBy='name'}" style="">
                        <a href="{sortlink orderBy='name' append='paged'}"><span>Název</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" id="title" class="manage-column {sortstate orderedBy='content'}" style="">
                        <a href="{sortlink orderBy='content' append='paged'}"><span>Obsah zdroje</span><span class="sorting-indicator"></span></a>
                    </th>
                    <th scope="col" id="title" class="manage-column {sortstate orderedBy='type'}" style="">
                        <a href="{sortlink orderBy='type' append='paged'}"><span>Typ zdroje</span><span class="sorting-indicator"></span></a>
                    </th>
                </tr> 
            </tfoot>
            <tbody id="the-list">
                {foreach $sources as $source} 
                <tr class="{cycle values='alternate,'}" valign="top">                    
                    <th scope="row" class="check-column">
                        {if current_user_can('administrator') || current_user_can('editor')}
                        <input type="checkbox" name="post[]" value="{$source.sourceId}">
                        {/if}
                    </th>   
                    <td class="column-icon media-icon">
                        {if $source.content == 'video'}
                        <img width="46" height="60" src="{site_url()}/wp-includes/images/crystal/video.png" class="attachment-80x60">
                        {elseif $source.content == 'post'}
                        <img width="46" height="60" src="{site_url()}/wp-includes/images/crystal/text.png" class="attachment-80x60">
                        {elseif $source.content == 'image'}
                        <img width="46" height="60" src="{plugins_url()}/ads-server/public/images/icons/crystal/image.png" class="attachment-80x60">
                        {/if}
                    </td>
                    <td class="post-title page-title column-title">
                        <strong>
                            {if current_user_can('administrator') || current_user_can('editor')}
                            <a class="row-title" href="{link target='self:editSource' sourceId=$source.sourceId}" title="Upravit „{$source.name|escape}“">{$source.name|escape}</a>
                            {else}
                            {$source.name|escape}
                            {/if}
                        </strong>
                        <div class="row-actions">
                            {if current_user_can('administrator') || current_user_can('editor')}
                            <span class="edit"><a href="{link target='self:editSource' sourceId=$source.sourceId}" title="Upravit tuto položku">Upravit</a> | </span>
                            {/if}
                            <span class="edit"><a href="{link target='self:editItems' sourceId=$source.sourceId}" title="Upravit položky">Upravit položky</a>{if current_user_can('administrator') || current_user_can('editor')} | {/if}</span>
                            {if current_user_can('administrator') || current_user_can('editor')}
                            <span class="trash"><a class="submitdelete" title="Přesunout tuto položku do koše" href="{link target='self:removeSource' sourceId=$source.sourceId token='true'}">Odstranit</a></span>
                            {/if}
                    </td>
                    <td class="post-title page-title column-title">
                        {if $source.content == 'video'}
                        Video
                        {elseif $source.content == 'post'}
                        Příspěvky
                        {elseif $source.content == 'image'}
                        Obrázky
                        {/if}
                    </td>
                    <td class="post-title page-title column-title">
                        {if $source.type == 'item'}
                        Položky
                        {elseif $source.type == 'tag'}
                        Štítky
                        {/if}
                    </td>
                </tr>
                {foreachelse}
                <tr>
                    <td colspan="4">Nejsou zadány žádné datové zdroje.</td>
                </tr>
                {/foreach}
            </tbody>
        </table>        
        <div class="tablenav bottom">
            {if current_user_can('administrator') || current_user_can('editor')}
            <div class="alignleft actions">
                <select name="action2">
                    <option value="-1" selected="selected">Hromadné úpravy</option>
                    <option value="remove">Odstranit</option>
                </select>
                <input type="submit" name="" id="doaction2" class="button-secondary action" value="Použít">
            </div>
            {/if}
            <div class="alignleft actions">
            </div>
            {include file="pager.tpl" pager=$pager page='defaultAction' append='orderBy,order'}
            <br class="clear">
        </div>
    </form>
</div>
